const baseURL = '/bs/'

// 分平台默认标识；真实标识存储在VUEX中
function getPlatFormCodeByUrl () {
  let realUrl = window.location.href
  if (window.location.port) {
    let errorUrlIndex = window.location.href.indexOf(';jsessionid')
    if (errorUrlIndex > -1) {
      realUrl = window.location.href.substring(0, errorUrlIndex)
    }
  }
  let _platformCode = GetQueryString('loginId')
  if (!_platformCode) {
    _platformCode = PLATCOEDEFAULT
    if (realUrl.indexOf('//fire.') > -1) {
      _platformCode = realUrl.split('//fire.')[1].split('.')[0]
    }
    if (realUrl.indexOf('//unit.') > -1) {
      _platformCode = realUrl.split('//unit.')[1].split('.')[0]
    }
  }
  return _platformCode
}
function GetQueryString (name) {
  let _url = window.location.search.substr(1)
  if (!_url) { // hash
    _url = window.location.href.split('?')[1]
  }
  if (!_url) return null
  var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
  var r = _url.match(reg)
  if (r != null) return unescape(r[2]); return null
}

// 默认图片
const defaultImg = 'resource/ilink_1571297675306.png'
const defultLogo = 'resource/rdspFile_1553739371033.png'
const defultDataSrc = 'resource/ilink_1571297690104.png'
const defultMapPeople = 'resource/icon-people.png'

/* 地图风格集合 */
const mapStyleArr = [
  {'style': 'c83fe24ef233ce8f08bd8c99447ce542', 'name': '绿'},
  {'style': '0d195d5200cbde7ac711c5b9b349f0da', 'name': '深蓝'},
]

// doker类型与服务端映射集合
const mapMarkJsonData = {
  'bg-alarm': {
    10: 'resource/alarm-10.png', // 报警
    20: 'resource/alarm-20.png', // 故障
    30: 'resource/alarm-30.png', // 屏蔽
    40: 'resource/alarm-40.png', // 联动
    0: 'resource/alarm-80.png' // 正常
  },
  'bg-alarm-new': {
    10: 'resource/bg-alarm-10.png', // 报警
    20: 'resource/bg-alarm-20.png', // 故障
    30: 'resource/bg-alarm-30.png', // 屏蔽
    40: 'resource/bg-alarm-40.png', // 联动
    0: 'resource/bg-alarm-80.png' // 正常
  },
  'bg-alarm-gif': {
    10: 'resource/alarm-10.gif', // 报警
    20: 'resource/alarm-20.gif', // 故障
    30: 'resource/alarm-30.gif', // 屏蔽
    40: 'resource/alarm-40.gif', // 联动
    0: 'resource/alarm-80.gif' // 正常
  },
  1: {// 业主单位
    bdIcon: 'resource/bg-mark-purple.png',
    bdIconTogether: null,
    iconW: 100,
    iconH: 100,
    iconTogetherW: 100,
    iconTogetherH: 100,
    dockerIcon: 'resource/bg-mark-purple.png'
  },
  2: {// 建筑物
    bdIcon: 'resource/bg-mark-blue.png',
    bdIconTogether: null,
    iconW: 100,
    iconH: 100,
    iconTogetherW: 100,
    iconTogetherH: 100,
    dockerIcon: 'resource/bg-mark-blue.png',
    bulidBg: 'resource/bmap-bulid-bg.png'
  },
  3: {// 视频球机
    bdIcon: 'resource/3.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/3.png'
  },
  4: {// 视频枪机
    bdIcon: 'resource/4.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/4.png'
  },
  11: {// 市政消火栓
    bdIcon: 'resource/11.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/11.png'
  },
  12: {// 天然水源
    bdIcon: 'resource/12.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/12.png'
  },
  13: {// 消防站
    bdIcon: 'resource/13.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/13.png'
  },
  14: {// 微型消防站
    bdIcon: 'resource/13.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/13.png'
  },
  20: {// 烟感
    bdIcon: 'resource/20.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/20.png'
  },
  21: {// 电气火灾
    bdIcon: 'resource/21.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/21.png'
  },
  22: {// 巡检点位
    bdIcon: {// 1表示合格，0表示不合格，2表示已领取，-1表示未领取
      0: 'resource/22-0.gif', // 不合格
      1: 'resource/22-1.gif', // 合格
      2: 'resource/22-2.gif', // 未完成
      '-1': 'resource/22-2.gif' // 未完成
    },
    bdIconTogether: null,
    iconW: 200,
    iconH: 200,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/13.png'
  },
  24: {// 消防水池
    bdIcon: 'resource/24.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/24.png'
  },
  25: {// 温度传感器
    bdIcon: 'resource/25.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/25.png'
  },
  26: {// 可燃气体
    bdIcon: 'resource/26.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/26.png'
  },
  27: {// 温感
    bdIcon: 'resource/27.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/27.png'
  },
  28: {// 手报
    bdIcon: 'resource/28.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/28.png'
  },
  29: {// 室内消火栓
    bdIcon: 'resource/29.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/29.png'
  },
  32: {// 隐患信息------建筑物
    // bdIcon: 'resource/32.png',
    bdIcon: {
      1: 'resource/bmap-32-1.png', // 整改中
      2: 'resource/bmap-32-2.png', // 已完成
      3: 'resource/bmap-32-3.png', // 核实中
      5: 'resource/bmap-32-5.png' // 待指派
    },
    fmapIcon: {
      1: 'resource/fmap-32-1.png', // 整改中
      2: 'resource/fmap-32-2.png', // 已完成
      3: 'resource/fmap-32-3.png', // 核实中
      5: 'resource/fmap-32-5.png' // 待指派
    },
    bdIconTogether: null,
    iconW: 150,
    iconH: 150,
    iconTogetherW: 88,
    iconTogetherH: 88,
    dockerIcon: ''
  },
  33: {// 维保信息------建筑物
    bdIcon: 'resource/33.png',
    bdIconTogether: null,
    iconW: 88,
    iconH: 88,
    iconTogetherW: 88,
    iconTogetherH: 88,
    dockerIcon: '',
    fmapIcon: 'resource/fmap-33.png'
  },
  34: {// 单位安全指数
    bdIcon: {
      0: 'resource/34-0.gif', // 红
      1: 'resource/34-1.gif', // 黄
      2: 'resource/34-2.gif' // 绿
    },
    fmapIcon: {
      0: 'resource/fmap-34-0.png', // 红
      1: 'resource/fmap-34-1.png', // 黄
      2: 'resource/fmap-34-2.png' // 绿
    },
    bdIconTogether: null,
    iconW: 120,
    iconH: 160,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/13.png'
  },
  36: {// 安全出口
    bdIcon: 'resource/36.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/36.png'
  },
  40: {// 有毒气体
    bdIcon: 'resource/40.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/40.png'
  },
  41: {// 风机
    bdIcon: 'resource/41.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/41.png'
  },
  42: {// 泵
    bdIcon: 'resource/42.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/42.png'
  },
  43: {// 防火门
    bdIcon: 'resource/43.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/43.png'
  },
  44: {// 防火卷帘
    bdIcon: 'resource/44.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/44.png'
  },
  45: {// 电梯
    bdIcon: 'resource/45.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/45.png'
  },
  46: {// 报警主机
    bdIcon: 'resource/46.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/46.png'
  },
  47: {// 消火栓报警按钮
    bdIcon: 'resource/47.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/47.png'
  },
  48: {// 室外消火栓
    bdIcon: 'resource/48.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/48.png'
  },
  49: {// 水流指示器
    bdIcon: 'resource/49.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/49.png'
  },
  50: {// 压力开关
    bdIcon: 'resource/50.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/50.png'
  },
  51: {// 楼栋警情概况
    bdIcon: {
      10: 'resource/popup-10.png', // 报警
      20: 'resource/popup-20.png', // 故障
      30: 'resource/popup-30.png', // 屏蔽
      40: 'resource/popup-40.png' // 联动
    },
    fmapIcon: {
      10: 'resource/fmap-popup-10.png', // 报警
      20: 'resource/fmap-popup-20.png', // 故障
      30: 'resource/fmap-popup-30.png', // 屏蔽
      40: 'resource/fmap-popup-40.png' // 联动
    },
    fmapIconNew: {
      10: 'resource/fmap-popup-10-new.png', // 报警
      20: 'resource/fmap-popup-20-new.png', // 故障
      30: 'resource/fmap-popup-30-new.png', // 屏蔽
      40: 'resource/fmap-popup-40-new.png' // 联动
    },
    bdIconTogether: null,
    iconW: 160,
    iconH: 122,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: ''
  },
  52: {// 声光报警器
    bdIcon: 'resource/52.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/52.png'
  },
  53: {// 消防电源
    bdIcon: 'resource/53.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/53.png'
  },
  54: {// 信号蝶阀
    bdIcon: 'resource/54.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/54.png'
  },
  55: {// 排烟阀
    bdIcon: 'resource/55.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/55.png'
  },
  56: {// 电磁阀
    bdIcon: 'resource/56.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/56.png'
  },
  57: {// 电磁阀
    bdIcon: 'resource/57.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/57.png'
  },
  58: {// 消防广播
    bdIcon: 'resource/58.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/58.png'
  },
  59: {// 防火阀
    bdIcon: 'resource/59.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/59.png'
  },
  60: {// 末端试水装置
    bdIcon: 'resource/60.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/60.png'
  },
  61: {// 水压传感器
    bdIcon: 'resource/61.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/61.png'
  },
  81: {// 消防车（81：消防车  82观光车  83摩托车）
    bdIcon: 'resource/81.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/81.png'
  },
  82: {// 观光车
    bdIcon: 'resource/82.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/82.png'
  },
  83: {// 摩托车
    bdIcon: 'resource/83.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/83.png'
  },
  91: {// 消控室
    bdIcon: 'resource/91.png',
    bdIconTogether: null,
    iconW: 50,
    iconH: 50,
    iconTogetherW: 50,
    iconTogetherH: 50,
    dockerIcon: 'resource/91.png'
  }
}

export default {
  baseURL,
  getPlatFormCodeByUrl,
  defaultImg,
  defultLogo,
  defultDataSrc,
  defultMapPeople,
  mapMarkJsonData,
  mapStyleArr
}
